//
//  UIBarButton+Extension.swift
//  LSWeibo1
//
//  Created by 李明禄 on 2018/12/5.
//  Copyright © 2018 SocererGroup. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    
    convenience init(title: String, fontSize: CGFloat = 16, normalColor: UIColor = .darkGray, highlightedColor: UIColor = .orange, isBack: Bool = false, target: Any?, action: Selector) {
        
        let btn: UIButton = UIButton.cz_textButton(title, fontSize: fontSize , normalColor: normalColor, highlightedColor: highlightedColor)
        
        
        if isBack {
            btn.setImage(UIImage.init(named: "navigationbar_back_withtext"), for: .normal)
            btn.setImage(UIImage.init(named: "navigationbar_back_withtext_highlighted"), for: .highlighted)
        }
        
        btn.addTarget(target, action: action, for: .touchUpInside)
        
        self.init(customView: btn)
        
    }

}
